{:W("Main",array('module'=>MODULE_NAME,'action'=>ACTION_NAME,'do'=>$_GET['do']))}
<link  href="__PUBLIC__/Assets/js/uploadify/uploadify.css" rel="stylesheet" type="text/css">
<script src="__PUBLIC__/Assets/js/uploadify/jquery.uploadify.js" type="text/javascript"></script>
<script type="text/javascript">
$(function() {
	$('#file_upload').uploadify({
		'formData'     : {
			'timestamp' : '{$_SERVER["REQUEST_TIME"]}',
			'token'     : '{$_SERVER["REQUEST_TIME"]|MD5}'
		},
		'onUploadSuccess' : function(file, data, response) {
			$('#logo').val(data);
		},
		'swf'         : '__PUBLIC__/Assets/js/uploadify/uploadify.swf',
		'uploader'    : '{:U("Public/upload")}',
		'buttonImage' : '__PUBLIC__/Assets/js/uploadify/swfBnt.png',
		'fileTypeExts': '*.bmp;*.jpg;*.jpeg;*.gif;*.png'//文件格式限制

	});
});
</script>
<div class="layout-main">    
    <div id="breadclumb" class="box">
        <h3><strong>{:lang('breadclumb_colon')}</strong>{:lang(MODULE_NAME)}<span></span><empty name="_GET.id">{:lang('add')}<else />{:lang('edit')}</empty></h3>
    </div>
    <div class="box clear-fix">
        <div class="layout-block-header"><h2>{:lang('details_info')}</h2></div>  
        <div id="AccountInfo">
            <div class="info-block">
                <form method="post" action="{:U(MODULE_NAME.'/proccess/')}" id="ajaxform" enctype="multipart/form-data">
                <table class="info-table">
                    <tbody>
						<if condition="!empty($info['id']) AND empty($info['status'])">
                        <tr>
                            <th><b class="verifing">*</b>{:lang('check_status_colon')}</th>
                            <td>
                                <input type="checkbox" name="status" value="1">
                                <span class="ui-validityshower-info">（选择此项提交则审核通过）</span>
                            </td>
                        </tr>
						</if>
                    	<tr>
                            <th><b class="verifing">*</b>{:lang('title_colon')}</th>
                            <td><input name="title" type="text" class="ui-text validate[required,minSize[2]]" size="40" value="{$info.title}"></td>
                        </tr>
                        <tr>
                            <th><b class="verifing">*</b>{:lang('url_colon')}</th>
                            <td>
                            <input name="url" id="url" type="text" class="ui-text validate[required,minSize[2],custom[url]]" size="40" value="{$info.url}">
                            <span class="ui-validityshower-info">（示例：http://www.baidu.com）</span>
                            </td>
                        </tr>
                        <tr>
                            <th><b class="verifing">*</b>{:lang('category_colon')}</th>
                            <td>
                                <div style="padding:0 10px;height:115px;width:400px;line-height:18px;border:1px solid #ccc;overflow-y:auto;">
                                	<ul id="category">
                                	<volist name="tags" id="vo">
                                    	<li>
                                        	<span style="margin-left:<php>echo ($vo['level']-1)*2;</php>em;"><gt name="vo.level" value="1">└─</gt>
                                        	<input type="checkbox" name="tags[]" value="{$vo.tags_type_id}" class="validate[minCheckbox[1]] <empty name="vo.pid">parent<else />child</empty>" <if condition="in_array($vo['tags_type_id'],$itemTags)">checked='checked'</if> <empty name="vo.pid">id="parent-{$vo.id}"<else />data-node="{$vo.pid}"</empty> />{$vo.name}
                                        </li>
                                    </volist>
                                    </ul>
                                </div>
                            </td>
                        </tr>
						<tr>
                            <th>{:lang('sortorder_colon')}</th>
                            <td>
                                <input name="sort_order" type="text" class="ui-text" value="{$info.sort_order|intval}" size="4">
                                <span class="ui-validityshower-info">（数字越大越靠前）</span>
                            </td>
                        </tr>
                        <tr>
                            <th>{:lang('hot_colon')}</th>
                            <td>
                                <input name="is_hot" type="checkbox" value="1" <notempty name="info.is_hot">checked="checked"</notempty>>
                            </td>
                        </tr>
                        
                        <tr>
                            <th>{:lang('logo_colon')}</th>
                            <td>
                                <input name="logo" id="logo" type="text" class="ui-text" value="{$info.logo}" size="40" style="float:left">
                                <input id="file_upload" name="file_upload" type="file" multiple="true" value="{:lang('upload')}">
                            </td>
                        </tr>
                        <tr>
                            <th>{:lang('details_content_colon')}</th>
                            <td>
                            	<textarea name="description" id="description" class="input-textarea editor" cols="80" rows="4">{$info.description}</textarea>
                                <span class="ui-validityshower-info">最佳字数：<b id="count" class="alert">0</b> / 35 个字符</span>
                            </td>
                        </tr>
                        <tr>
                            <th>&nbsp;</th>
                            <td>
                                <notempty name="_GET['id']">
									<input type="hidden" name="id" value="{$info.id}" />
								<else />
									<input type="hidden" name="status" value="1" />
								</notempty>
                                <input type="hidden" name="mid" value="{$_GET['mid']}" />
                                <input type="hidden" name="cid" value="{$_GET['cid']}" />
                                <input type="hidden" name="user_id" value="{$user.id}" />
                                <input type="submit" class="btn btn-ok" value="{:lang('confirm')}" />
                                <a class="btn" href="<empty name="_GET.id">{:U('Item/index')}<else />{$_SERVER['HTTP_REFERER']}</empty>">{:lang('goback')}</a>
                            </td>
                        </tr>
                    </tbody>
                </table>
                </form>
            </div>
        </div>  
    </div><!--.box-->
<link href="__PUBLIC__/Assets/js/validation/validationEngine.jquery.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="__PUBLIC__/Assets/js/validation/jquery.validationEngine.js"></script>
<script type="text/javascript" src="__PUBLIC__/Assets/js/validation/jquery.validationEngine-zh_CN.js"></script>
<script type="text/javascript" src="__PUBLIC__/Assets/js/jquery.form.js"></script>
<script type="text/javascript">
$(function(){
    $("#ajaxform").validationEngine('attach', {promptPosition : "centerRight", autoPositionUpdate : true});	
    $('#ajaxform').ajaxForm({
        timeout: 5000,
        error:function(){ $('#ajaxLoading').hide();alert("{:lang('ajaxError')}");},
        beforeSubmit:function(){ $('#ajaxLoading').show();},
        success:function(data){ 
            $('#ajaxLoading').hide();
            if(data.status==1){
                var redirectURL = "<empty name='_GET.id'>{:U('Item/index')}<else />{$_SERVER['HTTP_REFERER']}</empty>";
                $.alert(data.info,data.status,function(){window.location.href=redirectURL});
            }else{
                $.alert(data.info,data.status);
            }
        },
        dataType: 'json'
    });
});
    
$('#description').bind('keydown keyup click',function(){
	var len = $('#description').val().length;
	$('#count').html(len);	
})

$('#category .parent').click(function(){
	var id = $(this).val();
	var checked = $(this).attr('checked');
	var isCheck = checked=='checked'?checked:false;
	$('[data-node='+id+']').each(function () {
		$(this).attr('checked',isCheck);
    })
})
$('#category .child').click(function(){
	var id = $(this).attr('data-node');
	var checked = $(this).attr('checked');
	if(checked) $('#parent-'+id).attr('checked',checked);
})

</script>     
       
{:W("Foot")}   